import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

export default defineConfig({
  define: {
    'process.env': {},
  },
  plugins: [vue()],
  server: {
    host: '0.0.0.0',
    proxy: {
      '/360': {
        target: 'http://wallpaper.apc.360.cn',
        changeOrigin: true,
        rewrite: path => path.replace(/^\/360/, ''),
      },

      '/api': {
        target: 'http://106.13.91.201:5000/',
        changeOrigin: true,
        rewrite: path => path.replace(/^\/api/, ''),
      },

      '/upload': {
        target: 'https://upload-z1.qiniup.com',
        changeOrigin: true,
        rewrite: path => path.replace(/^\/upload/, ''),
      },

      '/api1': {
        target: 'http://apis.juhe.cn/',
        changeOrigin: true,
        rewrite: path => path.replace(/^\/api1/, ''),
      },

      '/mapi': {
        target: 'http://106.13.91.201:8848',
        changeOrigin: true,
        rewrite: path => path.replace(/^\/mapi/, ''),
      },
    },
  },
})
